home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / bsd / dev / FloppyDisk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-30  |  2.6 KB  |  113 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * FloppyDisk.h - Exported Interface for Floppy Disk device class. 
  4.  *
  5.  * HISTORY
  6.  * 14-May-91    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  */
  9. #ifndef    _BSD_DEV_FLOPPY_DISK_H_
  10. #define    _BSD_DEV_FLOPPY_DISK_H_ 
  11. #import <driverkit/return.h>
  12. #import <driverkit/IODisk.h>
  13. #import <bsd/dev/fd_extern.h>
  14. #import <bsd/dev/FloppyTypes.h>
  15. #import <mach/time_stamp.h>
  16. #import <kernserv/clock_timer.h>
  17.  
  18. typedef struct fd_format_info fdFormatInfo_t;
  19.  
  20. /*
  21.  * Enable FDIOCRRW, rawRead.
  22.  */
  23. #define RAWREAD_ENABLE    0
  24.  
  25. @interface FloppyDisk:IODisk<IODiskReadingAndWriting,IOPhysicalDiskMethods>
  26. {
  27. @private
  28.                     
  29.     /*
  30.      * The queues on which all I/Os are enqueued by exported methods. 
  31.      */
  32.     queue_head_t    ioQueueDisk;    // for I/Os requiring disk 
  33.     queue_head_t    ioQueueNodisk;    // for other I/O
  34.     id         ioQLock;    // NXConditionLock - protects the 
  35.                     //   queues; I/O thread sleeps on this
  36.     
  37.     id        cntrlr;        // FloppyController
  38.     int         innerRetryCount;
  39.     int         outerRetryCount;
  40.     ns_time_t    lastAccess;    // time disk last accessed
  41.     unsigned    timerRunning:1;
  42.     unsigned    inProbe;
  43.     
  44.     /*
  45.      * Drive and disk info.
  46.      */
  47.     fdDriveInfo_t    *driveInfo;
  48.     fdFormatInfo_t     formatInfo;    // density, #sects, etc. 
  49.     
  50. }
  51.  
  52. /*
  53.  * probe is invoked at load time. It determines what devices are on the
  54.  * bus and alloc's and init:'s an instance of this class for each one.
  55.  */
  56. + probe              : deviceDescription;
  57. + (IODeviceStyle)deviceStyle;
  58. + initialize;
  59. + (Protocol **)requiredProtocols;
  60.  
  61. - (BOOL)needsManualPolling;
  62.  
  63.  
  64. /*
  65.  * Methods unique to FloppyDisk class. These basically map to the 
  66.  * floppy-specific ioctl values in nextdev/fd_extern.h.
  67.  */
  68. - (IOReturn)fdCmdXfr        : (fdIoReq_t *)fdIoReq;              
  69. - (IOReturn)fdSetDensity    : (int)density;
  70. - (IOReturn)fdSetSectSize    : (int)sectSize;
  71. - (IOReturn)fdSetGapLength    : (int)gapLength;
  72. - (IOReturn)fdGetFormatInfo    : (struct fd_format_info *)formatInfo;
  73. - (IOReturn)fdSetInnerRetry    : (int)innerRetry;
  74. - (IOReturn)fdSetOuterRetry    : (int)outerRetry;
  75. - (int)innerRetry;
  76. - (int)outerRetry;
  77. - (IOReturn)fdMotorOff;
  78.  
  79. #if    RAWREAD_ENABLE
  80. /*
  81.  * Do simple read - no retries.
  82.  */
  83. - (fd_return_t)rawRead        : (int)sectNum 
  84.                    sectCount : (int)sectCount
  85.                    buffer : (void *)buffer;
  86. #endif    RAWREAD_ENABLE
  87. @end
  88.  
  89. #if     i386
  90. unsigned numFloppyDrives();
  91. unsigned floppyDriveType(int unit);
  92. #define FD_NODRIVE        0x00
  93. #define FD_360K            0x01
  94. #define FD_1200KB        0x02
  95. #define FD_720KB        0x03
  96. #define FD_1440KB        0x04
  97.  
  98. #define FD_TYPE_SHIFT    4
  99.  
  100. #define CMOSADDR    0x70
  101. #define CMOSDATA    0x71
  102. #define FD_TYPE        0x10
  103. #define FD_UNITS    0x14
  104.  
  105. #define FD_UNITS_MASK    0xC0
  106. #define FD_UNITS_SHIFT    6
  107. #define FD_MAX_UNITS    NUM_FD_UNITS        
  108. #endif    i386
  109.  
  110. #endif    _BSD_DEV_FLOPPY_DISK_H_
  111.  
  112.  
  113.